package com.sdp.khy.baotou.db.khy_package.service.impl;

import com.sdp.khy.baotou.db.khy_package.entity.KhyPackage;
import com.sdp.khy.baotou.db.khy_package.mapper.KhyPackageMapper;
import com.sdp.khy.baotou.db.khy_package.service.IKhyPackageService;
import com.sdp.khy.baotou.view.PackageInvoiceView;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zsp
 * @since 2023-11-29
 */
@Service
public class KhyPackageServiceImpl extends ServiceImpl<KhyPackageMapper, KhyPackage> implements IKhyPackageService {

	@Autowired
	private KhyPackageMapper khyPackageMapper;
	
	@Override
	public KhyPackage queryKhyPackageById(String keyId) {
		LambdaQueryWrapper<KhyPackage> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(KhyPackage::getKeyId, keyId);
		return getOne(queryWrapper,false);
	}

	@Override
	public List<KhyPackage> queryKhyPackageByState(String packageState) {
		LambdaQueryWrapper<KhyPackage> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(KhyPackage::getPackageState, packageState);
		return list(queryWrapper);
	}

	@Override
	public List<KhyPackage> queryKhyPackageByTransportId(String transportId) {
		LambdaQueryWrapper<KhyPackage> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(KhyPackage::getTransportId, transportId);
		return list(queryWrapper);
	}

	@Override
	public List<KhyPackage> getUserOrderNotInvoice(String userNo) {
		return khyPackageMapper.getUserOrderNotInvoice(userNo);
	}

	@Override
	public List<PackageInvoiceView> getUserOrderInvoice(String userNo) {
		return khyPackageMapper.getUserOrderInvoice(userNo);
	}

}
